var nian=2019;
var yue=5;

document.querySelector("#nian").innerHTML=nian;
document.querySelector("#yue").innerHTML=yue;

var tian=0;

function ruen(y){
    if (y %400 ===0 ||(y % 4 ===0&& y% 100!==0)){
        return true;
    }else {
        return false;
    }
}

for( var i=1980;i<nian;i++){
    if(ruen(i)){
        tian+=366;
    }else {
        tian+=365;
    }
}
console.log(tian);

for(var j=1;j<yue;j++){
    switch (j){
        case 1:
            tian+=31;
            break;
        case 2:
            if (ruen(nian)){
                tian+=29;
            }else {
                tian+=28;
            }
            break;
        case 3:
            tian+=31;
            break;
        case 4:
            tian+=30;
            break;
        case 5:
            tian+=31;
            break;
        case 6:
            tian+=30;
            break;
        case 7:
            tian+=31;
            break;
        case 8:
            tian+=31;
            break;
        case 9:
            tian+=30;
            break;
        case 10:
            tian+=31;
            break;
        case 11:
            tian+=30;
            break;
        case 12:
            tian+=31;
            break;
    }
}
console.log(tian);


var ben=0;
switch (yue){
    case 1:
        ben+=31;
        break;
    case 2:
        if (ruen(nian)){
            ben+=29;
        }else {
            ben+=28;
        }
        break;
    case 3:
        ben+=31;
        break;
    case 4:
        ben+=30;
        break;
    case 5:
        ben+=31;
        break;
    case 6:
        ben+=30;
        break;
    case 7:
        ben+=31;
        break;
    case 8:
        ben+=31;
        break;
    case 9:
        ben+=30;
        break;
    case 10:
        ben+=31;
        break;
    case 11:
        ben+=30;
        break;
    case 12:
        ben+=31;
        break;
}
console.log(ben);

var shangy=0;
switch (yue-1){
    case 1:
        shangy+=31;
        break;
    case 2:
        if (ruen(nian)){
            shangy+=29;
        }else {
            shangy+=28;
        }
        break;
    case 3:
        shangy+=31;
        break;
    case 4:
        shangy+=30;
        break;
    case 5:
        shangy+=31;
        break;
    case 6:
        shangy+=30;
        break;
    case 7:
        shangy+=31;
        break;
    case 8:
        shangy+=31;
        break;
    case 9:
        shangy+=30;
        break;
    case 10:
        shangy+=31;
        break;
    case 11:
        shangy+=30;
        break;
    case 12:
        shangy+=31;
        break;
}
console.log(shangy);


tian+=2;
var kong=tian%7;
console.log(kong);

var quan=42;

var xiay=quan-kong-ben;

var jin=new Date().getDate();

var dete2=document.querySelector("#dete2");

for (var k=shangy-kong+1;k<=shangy;k++){
    dete2.innerHTML+="<span class='g'>"+k+"</span>";
}

for (var h=1;h<=ben;h++){
    if (h==jin){
        dete2.innerHTML+="<span  class='j'>"+h+"</span>"; 
    }else {
        dete2.innerHTML+="<span>"+h+"</span>";
    }
}

for (var p=1;p<=xiay;p++){
    dete2.innerHTML+="<span class='g'>"+p+"</span>";
}


